package edu.pku.sei.act.sampletask.car;

import edu.pku.sei.act.actools.util.EnvInfo;
import edu.pku.sei.act.actools.util.TaskMessage;
import edu.pku.sei.act.sampletask.AutonomicParking;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.RemoteException;

public class _Parking extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		try {
			TaskMessage msg = _Car.communication.PARKING_NOTIFICATION;
			msg.setSender(AutonomicParking.getEe().getIdentity());
			long time = System.currentTimeMillis();
			AutonomicParking.getEe().notifyRWrite(EnvInfo.HEAD_TUPLE + "," + msg, time,time+2600);
			AutonomicParking.setState(_Car.state.QUERYING_PARKING_SLOT);
		} catch (RemoteException e) {
			e.printStackTrace();
		}
	}

}
